import { createSSRApp } from 'vue';
import App from './App.vue';
// import * as Pinia from 'pinia';
import { setupStore } from '@/stores/index';
import router from '@/routers'; // 引入路由
// @ts-ignore
import uView from '@/uni_modules/vk-uview-ui';

import SvgIcon from './components/SvgIcon.vue';
// import '@/static/iconfont/iconfont.js';
console.log(window);

export function createApp() {
  const app = createSSRApp(App);
  // 挂载store状态管理
  setupStore(app);
  // app.use(Pinia.createPinia());
  app.use(uView);
  // 注册svg 图标
  app.component('SvgIcon', SvgIcon);
  // 注册router
  // @ts-ignore
  uni.$Router = router;
  app.mixin({
    onLoad() {
      console.log('mixin onLoad');
      // 处理路由里面的参数
      // router.parseQuery()
    },
    onUnload() {
      console.log('mixin onUnload');
    },
  });
  return {
    app,
    // Pinia,
  };
}
